package leetcode.bitarithmetic.problem190;

public class Solution2 {
    // you need treat n as an unsigned value
    public int reverseBits(int n) {
      int ans = 0;
        for (int i = 0; i < 32; i++) {
            ans |= (n & 1) << (31 - i);
            n >>>= 1;
        }
        return ans;
    }
}
